Skip to content

[ExecuTorch][Vulkan] Add et_vk.fused_ce kernels (fused cross-entropy loss + dlogits)#20941

Merged
meta-codesync[bot] merged 12 commits into
gh/JCNTH/80/basefrom
gh/JCNTH/80/head
Jul 21, 2026
Merged

[ExecuTorch][Vulkan] Add et_vk.fused_ce kernels (fused cross-entropy loss + dlogits)#20941
meta-codesync[bot] merged 12 commits into
gh/JCNTH/80/basefrom
gh/JCNTH/80/head

Conversation

@JCNTH

@JCNTH JCNTH commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Vulkan GLSL kernels + handler for the training custom op et_vk.fused_ce (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like glsl/reduce_per_row_buffer.glsl (NWORKERS=64, one workgroup/row, barrier tree-combine); two dispatch nodes share loss_partial, ordered by the runtime per-vTensor barrier (same pattern as impl/SDPA.cpp QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
@exported-using-ghexport

Differential Revision: D111761780

Differential Revision: D111761780

[ghstack-poisoned]
@JCNTH
JCNTH requested a review from SS-JIA as a code owner July 14, 2026 21:50
@pytorch-bot pytorch-bot Bot added the module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/ label Jul 14, 2026
@pytorch-bot

pytorch-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20941

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 1 Cancelled Job, 1 Unrelated Failure

As of commit f5d76df with merge base 21554e5 (image):

NEW FAILURE - The following job has failed:

CANCELLED JOB - The following job was cancelled. Please retry:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@meta-codesync
meta-codesync Bot merged commit 1df99e1 into gh/JCNTH/80/base Jul 21, 2026
185 of 189 checks passed
@meta-codesync
meta-codesync Bot deleted the gh/JCNTH/80/head branch July 21, 2026 16:24
@meta-codesync
meta-codesync Bot temporarily deployed to cherry-pick-bot July 21, 2026 16:25 Inactive
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
JCNTH added a commit that referenced this pull request Jul 21, 2026
…loss + dlogits)

Pull Request resolved: #20941

Vulkan GLSL kernels + handler for the training custom op `et_vk.fused_ce` (fused CE: per-row online-softmax loss + dlogits, then an N->1 loss sum). Per-row shared-memory reduction structured like `glsl/reduce_per_row_buffer.glsl` (`NWORKERS=64`, one workgroup/row, barrier tree-combine); two dispatch nodes share `loss_partial`, ordered by the runtime per-`vTensor` barrier (same pattern as `impl/SDPA.cpp` QK->softmax->AV). AOT registration already exists under the shared Vulkan partitioner.
ghstack-source-id: 405059103
@exported-using-ghexport

Differential Revision: [D111761780](https://our.internmc.facebook.com/intern/diff/D111761780/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants